unit uDBPool;

interface

uses
  System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
  FireDAC.Phys, FireDAC.Comp.Client;

type
  TDBPool = class(TDataModule)
    FDManager: TFDManager;
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DBPool: TDBPool;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}

procedure TDBPool.DataModuleCreate(Sender: TObject);
var
  oParams: TStringList;
begin
  oParams := TStringList.Create;
  oParams.Add('StringFormat=Unicode');
  oParams.Add('Database=database.db');
  oParams.Add('OpenMode=CreateUTF8');
  oParams.Add('Pooled=SQLite');
  oParams.Add('POOL_CleanupTimeout=30000');
  oParams.Add('POOL_ExpireTimeout=60000');
  FDManager.AddConnectionDef('sqlite', 'SQLite', oParams);
  oParams.Free;
  FDManager.Active := true;
end;

end.

